package com.lln.cjcx.value;

/**
 * @author LiLinnan
 * @version 1.0
 * @date 2020/1/14 18:33
 */

public class UrlValue {
	private static final String LOGIN_URL = "http://xsjwxt.sxau.edu.cn:{port}/j_spring_security_check";
	private static final String CAPTCHA_GET_URL = "http://xsjwxt.sxau.edu.cn:{port}/img/captcha.jpg";
	private static final String CURRENT_TERM_GRADE_GET_URL = "http://xsjwxt.sxau.edu.cn:{port}/student/integratedQuery/scoreQuery/thisTermScores/data";
	private static final String GRADE_DETAIL_URL_GET_URL = "http://xsjwxt.sxau.edu.cn:{port}/student/integratedQuery/scoreQuery/subitemScore/searchFxcj";
	private static final String TERM_GET_URL = "http://xsjwxt.sxau.edu.cn:{port}/student/integratedQuery/scoreQuery/allTermScores/index";
	private static final String ALL_TERM_GRADE_GET_URL = "http://xsjwxt.sxau.edu.cn:{port}/student/integratedQuery/scoreQuery/allTermScores/data";

	/**
	 * 验证码接口
	 *
	 * @param port 端口号
	 * @return 验证码接口
	 */
	public static String captchaUrl(int port) {
		return getUrl(CAPTCHA_GET_URL, port);
	}

	/**
	 * 登录接口
	 *
	 * @param port 端口号
	 * @return 验证码接口
	 */
	public static String loginUrl(int port) {
		return getUrl(LOGIN_URL, port);
	}

	/**
	 * 本学期成绩接口
	 *
	 * @param port 端口号
	 * @return 本学期成绩接口
	 */
	public static String currentTermGradeGetUrl(int port) {
		return getUrl(CURRENT_TERM_GRADE_GET_URL, port);
	}

	/**
	 * 成绩详情获取接口
	 *
	 * @param port 端口号
	 * @return 成绩详情获取接口
	 */
	public static String gradeDetailUrlGetUrl(int port) {
		return getUrl(GRADE_DETAIL_URL_GET_URL, port);
	}


	/**
	 * 学期获取页面地址
	 *
	 * @param port 端口号
	 * @return 学期获取页面地址
	 */
	public static String termGetUrl(int port) {
		return getUrl(TERM_GET_URL, port);
	}


	public static String allTermGradeGetUrl(int port) {
		return getUrl(ALL_TERM_GRADE_GET_URL, port);
	}


	private static String getUrl(String url, int port) {
		return url.replace("{port}", Integer.toString(port));
	}
}
